/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bonc.common.security.dao;

import com.bonc.common.security.entity.MenuResource;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 *
 * @author song
 */
public interface MenuResourceDao2 extends JpaRepository<MenuResource, Long>  {
    /**
     * 返回来有权限的菜单
     * @return 
     */
    //@Query(" select  m from SysUser u  left join  u.roles r  left join   r.resources  m   where  u.loginId = ?1 ")
    @Query(" select  distinct(m) from SysUser u  left join  u.roles r  left join   r.resources  m   where  m in ( from MenuResource )  and u.loginId = ?1  ")
     public List  findAccessedMenu(String loginId);
    
}
